<template>
	<div>
		<div class="flex-between-center margin-bottom-4 margin-top-10">
			<el-tag type="primary" effect="plain" class="">
				<span class="el-icon-data-line item-gap"></span>
				<span>生产数据</span>
			</el-tag>
		</div>
		<jk-card>
			<el-form label-width="180px" :show-message="false" size="mini">
				<el-row class="flex-start-center-wrap">
					<el-col
						v-for="(item, index) in ruleForm.monitoringParamList || []"
						:key="index"
						:span="8"
					>
						<el-form-item class="machine-detail-form-item" :label="setLabel(item)">
							<span class="read-only-212">{{ item.currentValue || '0' }}{{ !item.unitLocal && item.unit ? item.unit : '' }}</span>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row v-if="machineItem.processCode && machineItem.processCode === 'DB'">
					<el-col :span="6">
						<el-form-item class="machine-detail-form-item" label="打包品种:">
							<span class="read-only-212">{{ ruleForm.pkgProductName || '无' }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item class="machine-detail-form-item" label="打包批号:">
							<span class="read-only-212">{{ ruleForm.pkgBatchCode || '无' }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item class="machine-detail-form-item" label="打包管色:">
							<span class="read-only-212">{{ ruleForm.pkgPaperColor || '无' }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item class="machine-detail-form-item" label="当班当前品种打包件数(件):">
							<span class="read-only-212">{{ ruleForm.pkgProductNum || '无' }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item class="machine-detail-form-item" label="当班当前品种打包重量(kg):">
							<span class="read-only-212">{{ ruleForm.pkgProductQty || '无' }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item class="machine-detail-form-item" label="当班总打包件数(件):">
							<span class="read-only-212">{{ ruleForm.pkgAllNum || '无' }}</span>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item class="machine-detail-form-item" label="当班总打包重量(kg):">
							<span class="read-only-212">{{ ruleForm.pkgAllQty || '无' }}</span>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row v-if="machineItem.typeCode && machineItem.typeCode === 'MASTER' && machineItem.processCode !== 'DB'">
					<el-col :span="6">
						<el-form-item class="machine-detail-form-item" label="设备效率:">
							<span class="read-only-212">{{ ruleForm.machineEfficiency || '0' }}%</span>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
		</jk-card>
	</div>
</template>
<script>
    export default {
        props: {
            ruleForm: {
                type: Object,
                default() {
                    return {};
                }
            },
            machineItem: {
                type: Object,
                default() {
                    return {};
                }
            }
        },
        methods: {
            setLabel(item) {
                let str = '';
                str = item.typeName || item.signalName;
                // unitLocal单位的朝向，左：true; 右: false
                if (item.unit && item.unitLocal) {
                    str += `(${item.unit})`;
                }
                str += `:`;
                return str;
            }
        }
    };
</script>
<style scoped lang="scss">
.machine-detail-form-item {
    margin-bottom: 0;
}
</style>
